function validatePriceValues()
{
	var bool = true;
	var pa = document.getElementById("errors");
	pa.innerHTML = "";
	var form = document.updateViewCostForm;
    if ( parseInt (form.count.value) == 1 )
	{
        if ( form.stdcost.value == "true")
        {
            for ( var a = 1; a < 5; a++ )
            {
                var field1 = eval("form['costList[0].q"+a+"StandardCost']");
                var field5 = eval("form['costList[0].q"+a+"Yield']");
                if ( parseInt ( field1.value.trim().length ) > 0 )
                {
                    //alter("outer -----------"+filed1.value);
                    if ( checkFloat ( field1.value,' Quarter '+a+ ' StandardCost ','Y'  ) == false )
                    {
                        //alter("inner -----------"+filed1.value);
                        pa.innerHTML = "<li> "+errMsg+" or characters";
                        field1.focus();
                        bool = false;
                        break;
                    }
                }
                if ( parseInt ( field5.value.trim().length ) > 0 )
                {
                    if ( checkFloat ( field5.value,' Quarter '+a+ ' Yield ','Y'  ) == false )
                    {
                        pa.innerHTML = "<li> "+errMsg+" or characters";
                        field5.focus();
                        bool = false;
                        break;
                    }
                }

                if ( parseFloat ( field5.value ) > 100 )
                {
                    pa.innerHTML = "<li> Yield should not be greater 100 ";
                    field5.focus();
                    bool = false;
                    break;
                }
            }
        }// for Projected Cost report
        else
        {
            var field1 = eval("form['costList[0].projectedCost']");
            var field5 = eval("form['costList[0].projectedYield']");
            if ( parseInt ( field1.value.trim().length ) > 0 )
            {
                //alter("outer -----------"+filed1.value);
                if ( checkFloat ( field1.value,' projectedCost ','Y'  ) == false )
                {
                    pa.innerHTML = "<li> "+errMsg+" or characters";
                    field1.focus();
                    bool = false;
                }
            }
            if ( parseInt ( field5.value.trim().length ) > 0 )
            {
                if ( checkFloat ( field5.value,' projectedYield ','Y'  ) == false )
                {
                    pa.innerHTML = "<li> "+errMsg+" or characters";
                    field5.focus();
                    bool = false;
                }
            }

            if ( parseFloat ( field5.value ) > 100 )
            {
                pa.innerHTML = "<li> Yield should not be greater 100 ";
                field5.focus();
                bool = false;
            }
        }
	}
	else
	{
		var countz = parseInt ( document.updateViewCostForm.count.value );
		bool = validateMultipleRows ( countz );
	}
	return bool;
}


function validateMultipleRows ( counts )
{
	var bool = true;
	var countz = parseInt( counts );
	var form = document.updateViewCostForm;
	var pa = document.getElementById("errors");
	pa.innerHTML = "";
	for ( var c = 0; c < countz; c++ )
	{
        if ( form.stdcost.value == "true")
        {
            for ( var a = 1; a < 5; a++ )
            {
                var field1 = eval("form['costList["+c+"].q"+a+"StandardCost']");
                var field5 = eval("form['costList["+c+"].q"+a+"Yield']");
                if ( parseInt ( field1.value.trim().length ) > 0 )
                {
                    if ( checkFloat ( field1.value,' Quarter '+a+ ' StandardCost ','Y'  ) == false )
                    {
                        pa.innerHTML = "<li> "+errMsg+" or characters";
                        field1.focus();
                        bool = false;
                        break;
                    }
                }
                if ( parseInt ( field5.value.trim().length ) > 0 )
                {
                    if ( checkFloat ( field5.value,' Quarter '+a+ ' Yield ','Y'  ) == false )
                    {
                        pa.innerHTML = "<li> "+errMsg+" or characters";
                        field5.focus();
                        bool = false;
                        break;
                    }
                }
                if ( parseFloat ( field5.value ) > 100 )
                {
                    pa.innerHTML = "<li> Yield should not greater 100 ";
                    field5.focus();
                    bool = false;
                    break;
                }

            }//inner for loop ends
            if ( bool == false )
            {
                break;
            }
        }// FOR PROJECTDE COST
        else
        {
            var field1 = eval("form['costList["+c+"].projectedCost']");
            var field5 = eval("form['costList["+c+"].projectedYield']");
            if ( parseInt ( field1.value.trim().length ) > 0 )
            {                 
                if ( checkFloat ( field1.value,' projectedCost ','Y'  ) == false )
                {
                    pa.innerHTML = "<li> "+errMsg+" or characters";
                    field1.focus();
                    bool = false;
                }
            }
            if ( parseInt ( field5.value.trim().length ) > 0 )
            {
                if ( checkFloat ( field5.value,' projectedYield ','Y'  ) == false )
                {
                    pa.innerHTML = "<li> "+errMsg+" or characters";
                    field5.focus();
                    bool = false;
                }
            }

            if ( parseFloat ( field5.value ) > 100 )
            {
                pa.innerHTML = "<li> Yield should not be greater 100 ";
                field5.focus();
                bool = false;
            }
            if ( bool == false )
            {
                break;
            }
        }
	}//outer for loop ends
	return bool;
}

function  copyValues(chkBox, i, prvQValue)
{
	var bool = true;
	var pa = document.getElementById("errors");
	pa.innerHTML = "";
	var form = document.updateViewCostForm;

	var currQValue = parseInt( prvQValue ) + 1;

	if( chkBox.checked == true )
    {
		var field1 = eval("form['costList[" + i + "].q"+prvQValue+"StandardCost']");
		var field5 = eval("form['costList[" + i + "].q"+prvQValue+"Yield']");

		var cField1 = eval("form['costList[" + i + "].q"+currQValue+"StandardCost']");
		var cField5 = eval("form['costList[" + i + "].q"+currQValue+"Yield']");

		if(field1.value != "0.000")
			cField1.value = field1.value;

		if(field5.value != "0.000")
			cField5.value = field5.value;

	}

}

